package com.qipay.api.util;

import org.apache.commons.lang3.StringUtils;

/**
 * Created by Administrator on 2017/9/25.
 */
public class StringSubUtil {


    public static String subAndOmitted(String str, int length){
        if(StringUtils.isBlank(str)) {
            return null;
        }
        String omitted = "";
        if(length < str.length()) {
            omitted = "...";
        }
        length = str.length() < length ? str.length() : length;
        return str.substring(0,length)+omitted;
    }



}
